<div class="content-titulo">
    
    <div class="filtro">
        <form id="form_filtro" method="get" action="">
            <i>Filtrar</i>
            <?php 
                //$f_cur = new Sistema_Model_DbTable_Catsegmento();
                //$f_cur = $f_cur->fetchAll('CTS_STA = 1');
                $query = 'SELECT SQL_CACHE CTS_ID,CTS_NOM FROM CATSEGMENTO WHERE CTS_STA = 1 ORDER BY CTS_ORD ASC';
                $f_cur = $this->db->fetchAll($query);
            
                $html = '<select id="filtroseg" name="filtroseg">';
                $html .= '<option value="">Todos Segmentos</option>';
                foreach($f_cur as $r){   
                    $select = $this->filtroseg == $r['CTS_ID'] ? 'selected':''; 
                    $html .= '<option '.$select.' value="'.$r['CTS_ID'].'">'.$r['CTS_NOM'].'</option>'; 
                }
                echo $html .= '</select>';
            ?>
            
            <input type="text" name="dscfiltro" value="<?php echo $this->dscfiltro; ?>" placeholder="Página" />
            
            <input type="submit" class="btn-pdr" name="buscar" value="buscar" />
        </form>
    </div>
    
    <div class="content-btn">
        <a href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'edit')); ?>">+</a>
    </div>
    
    <h2><?php echo $this->titulo;?></h2>
</div>

<div class="content-table">
    
    <table id="tlist" class="tb_content">
        <thead>
            <tr>
                <th>Código</th>
                <th>Nome</th>
                <th>Segmento</th>
                <th class="bc">&nbsp;</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($this->result as $row) { 
            //$cts = $row->findDependentRowSet("Sistema_Model_DbTable_Catsegmento");    
            ?>
                <tr>  
                    <td align="center"><?php echo $row['PAG_ID']; ?></td>
                    <td align="left"><?php echo $row['PAG_TITULO']; ?></td>
                    <td><?php echo $row['CTS_NOM']; ?></td>
                    <td class="bc">
                        <?php if($this->per_edt){?><a class="btn-pdr" href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'edit', 'id' => $row['PAG_ID'])); ?>">Editar</a><?php }?>
                        <?php if($this->per_del){?><a class="btn-pdr" href="javascript:void(0);" onclick="list_delete('<?php echo $this->controller; ?>', <?php echo $row['PAG_ID'] ?>, $(this));">Deletar</a><?php }?>
                        <?php if($this->per_edt){?><a class="btn-pdr" href="<?php echo $this->url(array('controller' => 'galeria')); ?>?tpo=<?php echo dominio::getGaleria($row['PAG_MODULO']); ?>&key=<?php echo $row['PAG_ID']; ?>">Galeria</a><?php }?>
                    </td>
                </tr>
            <?php } ?>
        </tbody>
    </table>
</div>
<?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml'); ?>